import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

class PickerLocalizations extends DefaultCupertinoLocalizations{

  @override
  String get todayLabel => '今天';

  @override
  String datePickerMinute(int minute) => "${minute.toString().padLeft(2, '0')}分";

  @override
  String datePickerHour(int hour) => "$hour时";

  @override
  String datePickerMediumDate(DateTime date) {
    return '${date.month}月${date.day}日';
  }

  static Future<CupertinoLocalizations> load(Locale locale) {
    return SynchronousFuture<CupertinoLocalizations>(
      PickerLocalizations()
    );
  }

  static const LocalizationsDelegate<CupertinoLocalizations> delegate =
  _PickerLocalizationsDelegate();
}

class _PickerLocalizationsDelegate
    extends LocalizationsDelegate<CupertinoLocalizations> {
  const _PickerLocalizationsDelegate();

  @override
  bool isSupported(Locale locale) => locale.languageCode == 'zh' || locale.languageCode == 'CN';

  @override
  Future<CupertinoLocalizations> load(Locale locale) =>
      PickerLocalizations.load(locale);

  @override
  bool shouldReload(_PickerLocalizationsDelegate old) => false;

  @override
  String toString() => 'PickerLocalizations.delegate(zh_CN)';
}